#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Instruction {
    // Load
    /// LDC N : AX = N
    LDC,
    /// AX = SS[BP - AX]
    LD,
    /// AX = SS[AX]
    ALD,

    // Save
    /// SS[BP - AX] = SS.TOP()
    ST,
    /// SS[AX] = SS.TOP()
    AST,

    // Push, Pop
    /// SS.PUSH(AX)
    PUSH,
    /// SS.POP()
    POP,

    // Jump
    /// JMP N : IP += N
    JMP,
    /// JZ N : if (AX == 0) IP += N
    JZ,

    // Arithmetic
    /// AX = SS.TOP() + AX
    ADD,
    /// AX = SS.TOP() - AX
    SUB,
    /// AX = SS.TOP() * AX
    MUL,
    /// AX = SS.TOP() / AX
    DIV,

    // Relationship
    /// AX = SS.TOP() < AX
    LT,
    /// AX = SS.TOP() <= AX
    LE,
    /// AX = SS.TOP() > AX
    GT,
    /// AX = SS.TOP() >= AX
    GE,
    /// AX = SS.TOP() == AX
    EQ,
    /// AX = SS.TOP() != AX
    NE,

    // I/O
    /// scanf("%d", &AX)
    IN,
    /// printf("%d\n", AX)
    OUT,

    // Address
    ADDR,

    // Functional
    CALL,
    RET,
}
